/************************************************************
 * Project Name         [Thinking_In_Java]
 * File Name            [TestThreadPool.java]
 * Creation Date        [04-Jul-2014]
 * 
 * Copyright© ge.y.yang@gmail.com All Rights Reserved
 * 
 * Work hard, play harder, think big and keep fit
 ************************************************************/
package pkg_08_thread.thread_pool;

/**
 * 测试线程池
 * 
 * @author 不落的太阳(Sean Yang)
 * @version 1.0
 * @since JDK 6
 * 
 */
public class TestThreadPool {
	/**
	 * 测试方法
	 * 
	 * @param args
	 *            命令行参数
	 */
	public static void main(String[] args) {

		// 线程池中的线程数
		int numThreads = 3;
		// 生成线程池
		MyThreadPool threadPool = new MyThreadPool(numThreads);

		// 任务数
		int numTasks = 10;
		// 运行任务
		for (int i = 0; i < numTasks; i++) {
			threadPool.performTask(new MyTask(i));
		}

		// 关闭线程池并等待所有任务完成
		threadPool.join();
	}

}
